// Copyright (C) 1953-2022 NUDT
// Verilog module name - local_access_control
// Version: V3.4.0.20220228
// Created:
//         by - fenglin
////////////////////////////////////////////////////////////////////////////
// Description:
//       
///////////////////////////////////////////////////////////////////////////
`timescale 1ns/1ps

module local_access_control
(
        i_clk,
        i_rst_n,       
        
        iv_command,
        i_command_wr,        
        ov_command_ack,
        o_command_ack_wr,
        
        o_hrg_wr,
        ov_hrg_wdata,
        ov_hrg_addr,
        o_hrg_rd,       
        i_hrg_wr,
        iv_hrg_raddr,
        iv_hrg_rdata,

        o_tan_wr,
        ov_tan_wdata,
        ov_tan_addr,     
        o_tan_rd,
        i_tan_wr,
        iv_tan_raddr,
        iv_tan_rdata, 
        
        o_ost_wr,
        ov_ost_wdata,
        ov_ost_addr,
        o_ost_rd,       
        i_ost_wr,
        iv_ost_raddr,
        iv_ost_rdata,

        o_cc_wr,
        ov_cc_wdata,
        ov_cc_addr,
        o_cc_rd,       
        i_cc_wr,
        iv_cc_raddr,
        iv_cc_rdata,
        
        o_tft_wr,
        ov_tft_wdata,
        ov_tft_addr,
        o_tft_rd,       
        i_tft_wr,
        iv_tft_raddr,
        iv_tft_rdata,      
        
        ov_hcp_ext_command      ,
        o_hcp_ext_command_wr    ,
        iv_hcp_ext_command_ack  ,
        i_hcp_ext_command_ack_wr 	
);
// I/O
// clk & rst
input               i_clk;
input               i_rst_n; 

input   [65:0]	    iv_command      ;
input    	        i_command_wr    ;
output  [65:0]	    ov_command_ack  ;
output   	        o_command_ack_wr;

output              o_hrg_wr;
output  [31:0]      ov_hrg_wdata;
output  [18:0]      ov_hrg_addr;     
output              o_hrg_rd;          
input               i_hrg_wr;
input   [18:0]      iv_hrg_raddr;
input   [31:0]      iv_hrg_rdata;

output              o_tan_wr;
output  [31:0]      ov_tan_wdata;
output  [18:0]      ov_tan_addr;       
output              o_tan_rd;
input               i_tan_wr;
input   [18:0]      iv_tan_raddr;
input   [31:0]      iv_tan_rdata;  

output              o_ost_wr;
output  [31:0]      ov_ost_wdata;
output  [18:0]      ov_ost_addr;    
output              o_ost_rd;          
input               i_ost_wr;
input   [18:0]      iv_ost_raddr;
input   [31:0]      iv_ost_rdata;

output              o_cc_wr;
output  [31:0]      ov_cc_wdata;
output  [18:0]      ov_cc_addr;   
output              o_cc_rd;          
input               i_cc_wr;
input   [18:0]      iv_cc_raddr;
input   [31:0]      iv_cc_rdata;

output              o_tft_wr;
output  [31:0]      ov_tft_wdata;
output  [18:0]      ov_tft_addr;   
output              o_tft_rd;          
input               i_tft_wr;
input   [18:0]      iv_tft_raddr;
input   [31:0]      iv_tft_rdata;

output  [65:0]	    ov_hcp_ext_command  ;
output   	        o_hcp_ext_command_wr  ;
input   [65:0]	    iv_hcp_ext_command_ack  ;
input    	        i_hcp_ext_command_ack_wr  ;

wire    [65:0]	    wv_hcp_int_command_inex2hcp;
wire	            w_hcp_int_command_wr_inex2hcp;
wire    [65:0]	    wv_command_ack_mcg2lecs;
wire     	        w_command_ack_wr_mcg2lecs;
command_parse_and_encapsulate_inex command_parse_and_encapsulate_inex_inst
(
.i_clk                      (i_clk                   ),
.i_rst_n                    (i_rst_n                 ),
                                                         
.iv_command                 (iv_command              ),
.i_command_wr               (i_command_wr            ),    
                                                     
.ov_hcp_int_command         (wv_hcp_int_command_inex2hcp          ),
.o_hcp_int_command_wr       (w_hcp_int_command_wr_inex2hcp        ),                            
.ov_hcp_ext_command         (ov_hcp_ext_command      ),
.o_hcp_ext_command_wr       (o_hcp_ext_command_wr    ),
                                                      
.iv_hcp_int_command         (wv_command_ack_mcg2lecs  ),  
.i_hcp_int_command_wr       (w_command_ack_wr_mcg2lecs),   
.iv_hcp_ext_command         (iv_hcp_ext_command_ack           ),   
.i_hcp_ext_command_wr       (i_hcp_ext_command_ack_wr         ), 
                             
.ov_command_ack             (ov_command_ack           ),
.o_command_ack_wr           (o_command_ack_wr         )
);

command_parse_and_encapsulate_hcp command_parse_and_encapsulate_hcp_inst
(
.i_clk            (i_clk                       ),
.i_rst_n          (i_rst_n                     ),
                                               
.iv_command       (wv_hcp_int_command_inex2hcp              ),
.i_command_wr     (w_hcp_int_command_wr_inex2hcp            ),    
                                               
.o_hrg_wr         (o_hrg_wr                    ),
.ov_hrg_wdata     (ov_hrg_wdata                ),
.ov_hrg_addr      (ov_hrg_addr                 ),        
.o_hrg_rd         (o_hrg_rd                    ),

.o_tan_wr         (o_tan_wr                    ),
.ov_tan_wdata     (ov_tan_wdata                ),
.ov_tan_addr      (ov_tan_addr                 ),     
.o_tan_rd         (o_tan_rd                    ),

.o_ost_wr         (o_ost_wr                    ),
.ov_ost_wdata     (ov_ost_wdata                ),
.ov_ost_addr      (ov_ost_addr                 ),      
.o_ost_rd         (o_ost_rd                    ),

.o_cc_wr          (o_cc_wr                    ),
.ov_cc_wdata      (ov_cc_wdata                ),
.ov_cc_addr       (ov_cc_addr                 ),      
.o_cc_rd          (o_cc_rd                    ),
                                              
.o_tft_wr         (o_tft_wr                    ),
.ov_tft_wdata     (ov_tft_wdata                ),
.ov_tft_addr      (ov_tft_addr                 ),      
.o_tft_rd         (o_tft_rd                    ),
                                                     
.i_hrg_wr         (i_hrg_wr                    ),
.iv_hrg_raddr     (iv_hrg_raddr                ),
.iv_hrg_rdata     (iv_hrg_rdata                ),

.i_tan_wr         (i_tan_wr                    ),
.iv_tan_raddr     (iv_tan_raddr                ),
.iv_tan_rdata     (iv_tan_rdata                ),

.i_ost_wr         (i_ost_wr                    ),
.iv_ost_raddr     (iv_ost_raddr                ),
.iv_ost_rdata     (iv_ost_rdata                ),

.i_cc_wr          (i_cc_wr                     ),
.iv_cc_raddr      (iv_cc_raddr                 ),
.iv_cc_rdata      (iv_cc_rdata                 ),

.i_tft_wr         (i_tft_wr                    ),
.iv_tft_raddr     (iv_tft_raddr                ),
.iv_tft_rdata     (iv_tft_rdata                ),

.ov_command_ack   (wv_command_ack_mcg2lecs     ),
.o_command_ack_wr (w_command_ack_wr_mcg2lecs   )            
);
endmodule 